fmmap 0.3.3

A flexible and convenient high-level mmap for zero-copy file I/O.
Documentation

A flexible and convenient high-level mmap for zero-copy file I/O.

English | 简体中文

Design

The design of this crate is inspired by Dgraph's mmap file implementation in Stretto.

All of file-backed memory map has the potential for Undefined Behavior (UB) if the underlying file is subsequently modified (e.g. the file is deleted by another process), in or out of process, this crate tries to avoid this situation by provide file lock APIs.

This crate supports std and popular async runtime(tokio, async-std, smol), and thanks to macro in Rust, it is super easy to support any new async runtime. For details, please see the implementation for tokio, async-std, smol of the source code.

Features

  • dozens of file I/O util functions
  • file-backed memory maps
  • synchronous and asynchronous flushing
  • copy-on-write memory maps
  • read-only memory maps
  • stack support (MAP_STACK on unix)
  • executable memory maps
  • file locks.
  • tokio
  • smol
  • async-std

Installation

  • std

    [dependencies]
    fmmap = 0.2 
    
  • tokio

    [dependencies]
    fmmap = { version = "0.3", features = ["tokio-async"] }
    
  • async-std

    [dependencies]
    fmmap = { version = "0.3", features = ["std-async"] }
    
  • smol

    [dependencies]
    fmmap = { version = "0.3", features = ["smol-async"] }
    

Examples

This crate is 100% documented, see documents for examples.

TODO

  • add benchmarks

License